import Layout from '@/layout'
import RouteButtonsBuilder from '@/framework/infra/router/RouterButtonsBuilder'
import TableButtonType from '@/framework/constant/TableButtonType'
import ComplainFollowUpStatusEnum from '@/feature/cmt/infra/constants/ComplainFollowUpStatusEnum'
import VoteBadCommentTypeEnum from '@/feature/cmt/infra/constants/VoteBadCommentTypeEnum'
import VoteBadCommentStatusEnum from '@/feature/cmt/infra/constants/VoteBadCommentStatusEnum'
import DeliveryComplainStatusEnum from '@/feature/cmt/infra/constants/DeliveryComplainStatusEnum'
import AheadRefundStatusEnum from '@/feature/cmt/infra/constants/AheadRefundStatusEnum'
import ExpressLossPaidStatusEnum from '@/feature/cmt/infra/constants/ExpressLossPaidStatusEnum'
import ExpressLossReceiveFlagEnum from '@/feature/cmt/infra/constants/ExpressLossReceiveFlagEnum'
import ExpressLossResultStatusEnum from '@/feature/cmt/infra/constants/ExpressLossResultStatusEnum'

export default [
  {
    path: '/cmt',
    component: Layout,
    meta: { title: '售后', icon: 'el-icon-s-help' },
    children: [
      {
        path: 'vote-bad-comment',
        component: () => import('@/feature/cmt/app/vote-bad-comment/index'),
        meta: { title: '差评登记', icon: 'table', dataCount: 'badComment.WAIT_SUBMIT' },
        buttons: RouteButtonsBuilder.builder('cmt:vote-bad-comment').view('list')
          .addButtons([
            {
              handler: 'list',
              name: 'list',
              type: TableButtonType.SEARCHBAR,
              label: '搜索',
              icon: 'el-icon-search'
            },
            {
              handler: 'submitFollow',
              name: 'list',
              type: TableButtonType.ROW,
              label: '提交',
              buttonType: 'danger',
              showFilter: value => value.status === VoteBadCommentStatusEnum.WAIT_SUBMIT.id
            },
            {
              handler: 'export',
              name: 'export',
              type: TableButtonType.TOOLBAR_RIGHT,
              label: '导出',
              buttonType: 'primary',
              icon: 'el-icon-download'
            },
            {
              handler: 'create',
              name: 'create',
              type: TableButtonType.TOOLBAR,
              label: '新建店铺差评',
              icon: 'el-icon-plus'
            },
            {
              handler: 'update',
              name: 'update',
              type: TableButtonType.ROW,
              label: '修改',
              // showFilter: value => value.status === VoteBadCommentStatusEnum.WAIT_SUBMIT.id,
              icon: 'el-icon-edit'
            },
            {
              handler: 'remove',
              name: 'remove',
              type: TableButtonType.ROW,
              label: '删除',
              buttonType: 'danger',
              // showFilter: value => value.status === VoteBadCommentStatusEnum.WAIT_SUBMIT.id,
              icon: 'el-icon-delete'
            }
          ])
          .build()
      },
      {
        path: 'vote-bad-comment-follow',
        component: () => import('@/feature/cmt/app/vote-bad-comment/index'),
        meta: {
          title: '差评跟进',
          icon: 'table',
          status: VoteBadCommentStatusEnum.WAIT_FOLLOW.id,
          dataCount: 'badComment.WAIT_FOLLOW'
        },
        buttons: RouteButtonsBuilder.builder('cmt:vote-bad-comment:follow')
          .view()
          .addButtons([
            {
              handler: 'list',
              type: TableButtonType.SEARCHBAR,
              label: '搜索',
              icon: 'el-icon-search'
            },
            {
              handler: 'follow',
              type: TableButtonType.ROW,
              label: '跟进',
              icon: 'el-icon-plus'
            },
            {
              handler: 'reject-follow',
              type: TableButtonType.ROW,
              showFilter: value => value.status === VoteBadCommentStatusEnum.WAIT_FOLLOW.id,
              label: '拒绝跟进',
              buttonType: 'danger'
            }
          ])
          // .addCheck(false)

          .build()
      },
      // {
      //   path: 'vote-bad-comment-my-follow',
      //   component: () => import('@/feature/cmt/app/vote-bad-comment/index'),
      //   meta: {title: '我的差评跟进', icon: 'table', status: VoteBadCommentStatusEnum.ING.id},
      //   buttons: RouteButtonsBuilder.builder('cmt:vote-bad-comment:follow')
      //     .addButtons([
      //       {
      //         handler: 'list',
      //         type: TableButtonType.SEARCHBAR,
      //         label: '搜索',
      //         icon: 'el-icon-search'
      //       },
      //       {
      //         handler: 'follow',
      //         type: TableButtonType.ROW,
      //         label: '继续跟进',
      //         icon: 'el-icon-plus'
      //       }
      //     ])
      //     .build()
      // },
      {
        path: 'vote-bad-comment-check',
        component: () => import('@/feature/cmt/app/vote-bad-comment/index'),
        meta: {
          title: '差评审核',
          icon: 'table',
          status: VoteBadCommentStatusEnum.WAIT_FINISH.id,
          dataCount: 'badComment.WAIT_FINISH'
        },
        buttons: RouteButtonsBuilder.builder('cmt:vote-bad-comment:check')
          // .view()
          .addButton({
            handler: 'view',
            type: TableButtonType.ROW,
            label: '详情',
            groupId: 1,
            icon: 'el-icon-view'
          })
          .addButton({
            handler: 'list',
            groupId: 1,
            type: TableButtonType.SEARCHBAR,
            label: '搜索',
            icon: 'el-icon-search'
          })
          .r({ exported: false }).addCheck(true)
          .build()
      },
      {
        path: 'vote-bad-comment-data',
        component: () => import('@/feature/cmt/app/vote-bad-comment/data'),
        meta: {
          title: '差评数据报表',
          icon: 'table'
        },
        buttons: RouteButtonsBuilder.builder('cmt:vote-bad-comment:data')
          .r({ exported: false })
          .build()
      },
      {
        path: 'delivery-complain',
        component: () => import('@/feature/cmt/app/delivery-complain/index'),
        meta: {
          title: '发货投诉登记', icon: 'table'
          // dataCount: 'delivery.WAIT_SUBMIT'
        },
        buttons: RouteButtonsBuilder.builder('cmt:delivery-complain').view('list')

          .addButtons([
            {
              handler: 'list',
              name: 'list',
              type: TableButtonType.SEARCHBAR,
              label: '搜索',
              icon: 'el-icon-search'
            },

            {
              handler: 'export',
              name: 'export',
              type: TableButtonType.TOOLBAR_RIGHT,
              label: '导出',
              buttonType: 'primary',
              icon: 'el-icon-download'
            },
            {
              handler: 'create',
              name: 'create',
              type: TableButtonType.TOOLBAR,
              label: '新建发货投诉',
              icon: 'el-icon-plus'
            },
            {
              handler: 'import',
              name: 'create',
              type: TableButtonType.TOOLBAR,
              label: '导入',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            },
            {
              handler: 'importOrderAmount',
              name: 'create',
              type: TableButtonType.TOOLBAR,
              label: '导入订单金额',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            },
            {
              handler: 'submitFollow',
              name: 'list',
              type: TableButtonType.ROW,
              label: '提交',
              buttonType: 'danger',
              showFilter: value => value.status === DeliveryComplainStatusEnum.WAIT_SUBMIT.id
            }, {
              handler: 'clearAll',
              buttonType: 'danger',
              name: 'create',
              type: TableButtonType.TOOLBAR,
              label: '批量清理',
              icon: 'el-icon-edit'
            },
            {
              handler: 'update',
              name: 'update',
              type: TableButtonType.ROW,
              label: '修改',
              icon: 'el-icon-edit'
            },
            {
              handler: 'remove',
              name: 'remove',
              type: TableButtonType.ROW,
              label: '删除',
              buttonType: 'danger',
              icon: 'el-icon-delete'
            }

          ])
          .build()
      },
      // {
      //   path: 'delivery-complain-follow',
      //   component: () => import('@/feature/cmt/app/delivery-complain/index'),
      //   meta: {
      //     title: '发货投诉跟进',
      //     icon: 'table',
      //     status: DeliveryComplainStatusEnum.WAIT_FOLLOW.id,
      //     dataCount: 'delivery.WAIT_FOLLOW'
      //   },
      //   buttons: RouteButtonsBuilder.builder('cmt:delivery-complain:follow')
      //     .view()
      //     .addButtons([
      //       {
      //         handler: 'list',
      //         type: TableButtonType.SEARCHBAR,
      //         label: '搜索',
      //         icon: 'el-icon-search'
      //       },
      //       {
      //         handler: 'follow',
      //         type: TableButtonType.ROW,
      //         label: '跟进',
      //         icon: 'el-icon-plus'
      //       },
      //       {
      //         handler: 'reject-follow',
      //         type: TableButtonType.ROW,
      //         // showFilter: value => value.status === DeliveryComplainStatusEnum.WAIT_FOLLOW.id,
      //         label: '拒绝跟进',
      //         buttonType: 'danger'
      //       }
      //     ])
      //     .build()
      // },
      {
        path: 'delivery-complain-check',
        component: () => import('@/feature/cmt/app/delivery-complain/index'),
        meta: {
          title: '发货投诉审核', icon: 'table',
          status: DeliveryComplainStatusEnum.WAIT_FINISH.id,
          dataCount: 'delivery.WAIT_FINISH'
        },
        buttons: RouteButtonsBuilder.builder('cmt:delivery-complain:check').view()
          .addButton({
            handler: 'view',
            type: TableButtonType.ROW,
            label: '详情',
            groupId: 1,
            icon: 'el-icon-view'
          })
          .addButton({
            handler: 'list',
            groupId: 1,
            type: TableButtonType.SEARCHBAR,
            label: '搜索',
            icon: 'el-icon-search'
          })
          .r({ exported: false }).addCheck()
          .build()
      },
      {
        path: 'delivery-complain-data',
        component: () => import('@/feature/cmt/app/delivery-complain/data'),
        meta: { title: '发货投诉报表', icon: 'table' },
        buttons: RouteButtonsBuilder.builder('cmt:delivery-complain:data').build()
      },
      {
        path: 'ahead-refund-register',
        component: () => import('@/feature/cmt/app/ahead-refund-register/index'),
        meta: { title: '提前退款登记', icon: 'table' },
        buttons: RouteButtonsBuilder.builder('cmt:ahead-refund-register')
          .addButtons([
            {
              handler: 'list',
              name: 'list',
              type: TableButtonType.SEARCHBAR,
              label: '搜索',
              icon: 'el-icon-search'
            },
            {
              handler: 'export',
              name: 'export',
              type: TableButtonType.TOOLBAR_RIGHT,
              label: '导出',
              buttonType: 'primary',
              icon: 'el-icon-download'
            },
            {
              handler: 'create',
              name: 'create',
              type: TableButtonType.TOOLBAR,
              label: '新建提前退款登记',
              icon: 'el-icon-plus'
            },
            {
              handler: 'update',
              name: 'update',
              type: TableButtonType.ROW,
              label: '修改',
              icon: 'el-icon-edit'
            }, {
              handler: 'import',
              name: 'create',
              type: TableButtonType.TOOLBAR_RIGHT,
              label: '导入退货状态',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            }, {
              handler: 'follow',
              name: 'follow',
              type: TableButtonType.ROW,
              label: '标记仓库已退货',
              buttonType: 'danger',
              showFilter: value => value.status === AheadRefundStatusEnum.WAIT_FOLLOW.id
            },
            {
              handler: 'remove',
              name: 'remove',
              type: TableButtonType.ROW,
              label: '删除',
              buttonType: 'danger',
              icon: 'el-icon-delete'
            },
            {
              handler: 'batch-follow',
              name: 'follow',
              buttonType: 'danger',
              type: TableButtonType.TOOLBAR,
              label: '批量标记仓库已退货',
              icon: 'el-icon-edit'
            }

          ])
          .build()
      },
      {
        path: 'express-lost',
        component: () => import('@/feature/cmt/app/express-lost/index'),
        meta: { title: '快递遗失登记', icon: 'table' },
        buttons: RouteButtonsBuilder.builder('cmt:express-lost')

          .addButtons([
            {
              handler: 'list',
              type: TableButtonType.SEARCHBAR,
              label: '搜索',
              icon: 'el-icon-search'
            },
            {
              handler: 'export',
              type: TableButtonType.TOOLBAR_RIGHT,
              label: '导出',
              buttonType: 'primary',
              icon: 'el-icon-download'
            },
            {
              handler: 'create',
              type: TableButtonType.TOOLBAR,
              label: '新建快递遗失登记',
              icon: 'el-icon-plus'
            },
            {
              handler: 'update',
              type: TableButtonType.ROW,
              label: '修改',
              icon: 'el-icon-edit'
            },
            {
              handler: 'remove',
              type: TableButtonType.ROW,
              label: '删除',
              buttonType: 'danger',
              icon: 'el-icon-delete'
            }, {
              handler: 'updateResultStatus',
              type: TableButtonType.ROW,
              label: '结果处理',
              showFilter: value => value.resultStatus === ExpressLossResultStatusEnum.NO.id,
              buttonType: 'danger',
              icon: 'el-icon-delete'
            }
          ])
          .build()
      },
      {
        path: 'product-offline-register',
        component: () => import('@/feature/pdt/app/product-offline-register/index'),
        meta: { title: '商品换货登记', icon: 'table' },
        buttons: RouteButtonsBuilder.builder('pdt:product-offline-register')
          .addButtons([
            {
              handler: 'list',
              type: TableButtonType.SEARCHBAR,
              label: '搜索',
              icon: 'el-icon-search'
            },
            {
              handler: 'export',
              type: TableButtonType.TOOLBAR_RIGHT,
              label: '导出',
              buttonType: 'primary',
              icon: 'el-icon-download'
            },
            {
              handler: 'create',
              type: TableButtonType.TOOLBAR,
              label: '新建商品换货登记',
              icon: 'el-icon-plus'
            },
            {
              handler: 'import',
              type: TableButtonType.TOOLBAR,
              label: '导入',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            },
            {
              handler: 'batchOfflineHandle',
              type: TableButtonType.TOOLBAR,
              label: '批量标记商品换货处理',
              buttonType: 'success',
              icon: 'el-icon-upload'
            },
            {
              handler: 'offlineHandle',
              type: TableButtonType.ROW,
              label: '标记商品换货处理',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            },
            {
              handler: 'batchExchangeFollow',
              type: TableButtonType.TOOLBAR,
              label: '批量标记换货跟进',
              buttonType: 'warning',
              icon: 'el-icon-upload'
            },
            {
              handler: 'exchangeFollow',
              type: TableButtonType.ROW,
              label: '标记换货跟进',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            },
            {
              handler: 'update',
              type: TableButtonType.ROW,
              label: '修改',
              icon: 'el-icon-edit'
            },
            {
              handler: 'remove',
              type: TableButtonType.ROW,
              label: '删除',
              buttonType: 'danger',
              icon: 'el-icon-delete'
            },
            {
              handler: 'batchDistribution',
              type: TableButtonType.TOOLBAR,
              label: '批量分配所选',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            }, {
              handler: 'batchDistributionBackend',
              type: TableButtonType.TOOLBAR,
              label: '批量分配',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            }
          ])
          .build()
      },
      {
        path: 'mine-product-offline-register',
        component: () => import('@/feature/pdt/app/product-offline-register/my_index'),
        meta: { title: '我的换货登记', icon: 'table' },
        buttons: RouteButtonsBuilder.builder('pdt:mine-product-offline-register')
          .addButtons([
            {
              handler: 'list',
              type: TableButtonType.SEARCHBAR,
              label: '搜索',
              icon: 'el-icon-search'
            },
            {
              handler: 'export',
              type: TableButtonType.TOOLBAR_RIGHT,
              label: '导出',
              buttonType: 'primary',
              icon: 'el-icon-download'
            },
            // {
            //   handler: 'create',
            //   type: TableButtonType.TOOLBAR,
            //   label: '新建商品换货登记',
            //   icon: 'el-icon-plus'
            // },
            // {
            //   handler: 'import',
            //   type: TableButtonType.TOOLBAR,
            //   label: '导入',
            //   buttonType: 'danger',
            //   icon: 'el-icon-upload'
            // },
            {
              handler: 'batchOfflineHandle',
              type: TableButtonType.TOOLBAR,
              label: '批量标记商品换货处理',
              buttonType: 'success',
              icon: 'el-icon-upload'
            },
            {
              handler: 'offlineHandle',
              type: TableButtonType.ROW,
              label: '标记商品换货处理',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            },
            {
              handler: 'batchExchangeFollow',
              type: TableButtonType.TOOLBAR,
              label: '批量标记换货跟进',
              buttonType: 'warning',
              icon: 'el-icon-upload'
            },
            {
              handler: 'exchangeFollow',
              type: TableButtonType.ROW,
              label: '标记换货跟进',
              buttonType: 'danger',
              icon: 'el-icon-upload'
            },
            {
              handler: 'update',
              type: TableButtonType.ROW,
              label: '修改',
              icon: 'el-icon-edit'
            }
            // {
            //   handler: 'remove',
            //   type: TableButtonType.ROW,
            //   label: '删除',
            //   buttonType: 'danger',
            //   icon: 'el-icon-delete'
            // }
          ])
          .build()
      }
      // #appendSpot# 生成工具用，不要删了
    ]
  }
]
